// Mesh.h
// 
#ifndef MESH_ONCE
#define MESH_ONCE

#include "Framework_Exports.h"

#include "Math/Math.h"
#include "Math/Box.h"

#include <vector>

namespace tri{

class FWK_API Mesh
{
public:

	// @todo: class Face in a different file
	struct Face
	{
		unsigned int v0;
		unsigned int v1;
		unsigned int v2;
		Math::vec3   normal;
		Face( unsigned int _v0, unsigned int _v1, unsigned int _v2 ) : v0(_v0), v1(_v1), v2(_v2) {}
	};

	// @todo: class Vertex in a different file
	struct Vertex
	{
		Math::dvec3  position;
		Math::vec3   normal;
		Math::vec2   uv;
		Math::u8vec3 color;

		//Math::vec3   quality;
	};

	// @todo: edge class?

private:
	std::vector<Face>   _faces;
	std::vector<Vertex> _vtx;

	Math::box3          _boundingBox;

public:
	Mesh();
	Mesh( const std::vector<Math::dvec3> &vertices, const std::vector<unsigned int> &indices );

	~Mesh();

	void computeNormals();
	void updateBoundingBox();

};

}

#endif